let form = layui.form

form.verify({
 len: [/^\S{6,12}$/, '长度必须6~12位且不能出现空格'],
  diff :function(val){
    if(val === $('input[name=oldPwd]').val()){
      return '新密码不能与旧密码一致'
    }
  } ,
  same :function(val){
    if (val !== $('input[name=newPwd]').val()) {
      return '密码不正确'
    }
  },
})

// 修改密码


// ----------------------- 完成重置密码 -----------------------
$('form').on('submit',function(e){
  e.preventDefault()
  let data = $(this).serialize()
  axios.post('/my/user/updatepwd', data)
  .then(function (res) {
    console.log(res)
    let {status,message} = res.data;
    if(status === 0 ){
    layer.msg(message)
    localStorage.removeItem('token')
    window.parent.location.href = '../index.html'
    }
   })
})